`Repairing' LATEX's standard document styles

A large part of the core of the babel system is dedicated to `repair' the standard document styles. This means redefining the macros in table [*].


Table: macros that need to be redefined for the four standard document styles.
macro article report book letter
\fnum@figure × × × ×
\fnum@table × × × ×
\tableofcontents × × ×  
\listoffigures × × ×  
\listoftables × × ×  
\thebibliography × × ×  
\theindex × × ×  
\abstract × × ×  
\part × × ×  
\chapter   × ×  
\appendix   × ×  
\cc       ×
\encl       ×
\ps@headings       ×


As an example of the way the macros have to be redefined, the redefinition of \tableofcontents is shown in figure [*].

Figure: An example of redefining a command
\begin{figure*}\begin{verbatim}\@ifundefined{contentsname}
{\def\tableofconte...
...dafter{\contentsname}}
}
\@starttoc{toc}
}
}
{}\end{verbatim}
\end{figure*}

The standard styles can be distinguished by checking the existence of the macros \chapter (not in article and letter) and \opening (only in letter). The result of these checks is stored in the macro \doc@style. When \doc@style already exists (which is the case when for instance artikel1.sty is used [7]) it is not superseded (see figure [*]).

Figure: Determining the main document style
\begin{figure*}\begin{verbatim}\@ifundefined{doc@style}
{\def\doc@style{0}
\...
...{\def\doc@style{2}}
}{\def\doc@style{3}}
}{\relax}\end{verbatim}
\end{figure*}